from glob import glob
dir = input('Director: ')
dir = dir.replace('\\','/')
if dir[-1]!='/':
    dir+='/'
# ext = input('Mode: ')
files = [
"svgeditor/js/utils.js",
"svgeditor/js/dao.js",
"svgeditor/js/state.js",
"svgeditor/js/sanitize.js",
"svgeditor/js/browser.js",
"svgeditor/js/svgutils.js",
"svgeditor/js/history.js",
"svgeditor/js/select.js",
"svgeditor/js/path.js",
"svgeditor/js/sanitize.js",
"svgeditor/js/units.js",
"svgeditor/js/math.js",
"svgeditor/js/translate.js",
"svgeditor/js/svgtransformlist.js",
"svgeditor/js/draw.js",
"svgeditor/js/svgcanvas.js",
"svgeditor/js/editor.js",
"svgeditor/js/Canvas.js",
"svgeditor/js/Text.js",
"svgeditor/js/Pan.js",
"svgeditor/js/Panel.js",
"svgeditor/js/Rulers.js",
"svgeditor/js/Toolbar.js",
"svgeditor/js/Menu.js",
"svgeditor/js/Keyboard.js",
"svgeditor/js/Import.js",
"svgeditor/js/PaintBox.js",
"svgeditor/js/Palette.js",
"svgeditor/js/Zoom.js",
"svgeditor/js/Modal.js",
"svgeditor/js/Title.js",
"svgeditor/js/darkmode.js",
"svgeditor/js/ContextMenu.js",
"svgeditor/js/Shapelib.js",
"svgeditor/js/fonts.js",
"svgeditor/js/dialog.js",
"svgeditor/js/lib/contextmenu.js",
"svgeditor/js/lib/jpicker.min.js",
"svgeditor/js/lib/mousewheel.js",
"svgeditor/js/eyedropper.js",
"svgeditor/js/lib/requestanimationframe.js",
"svgeditor/js/lib/taphold.js",
"svgeditor/js/lib/filesaver.js",
"svgeditor/js/paste.js",
"svgeditor/js/modals.js",
"svgeditor/js/start.js",
]
# print(files)
with open(dir+'0merge','w',encoding='utf-8') as m:
    for i in files:
        with open(dir+i,'r',encoding='utf-8') as f:
            sep = f.name.rfind('\\');
            if sep<0:sep = f.name.rfind('/')
            dot = f.name.rfind('.')
            if dot<sep:dot = -1
            name = f.name[sep+1:dot]
            m.write('\n/* '+name+' */\n')
            m.write(f.read())